package com.jsmy.marketing.base;

import android.content.Context;
import android.support.multidex.MultiDex;
import android.support.multidex.MultiDexApplication;

import com.jsmy.marketing.utils.SharedP;
import com.umeng.analytics.MobclickAgent;
import com.umeng.commonsdk.UMConfigure;
import com.umeng.socialize.PlatformConfig;

import cn.jpush.android.api.JPushInterface;
import cn.jpush.im.android.api.JMessageClient;

/**
 * Created by PC_WLT on 2018/8/24.
 */

public class BaseApplication extends MultiDexApplication {
    public static BaseApplication mInstance;
    public String longitude;
    public String latitude;
    @Override
    public void onCreate() {
        super.onCreate();
        mInstance = this;
        new SharedP(this);
        //友盟
        MobclickAgent.openActivityDurationTrack(false);
        UMConfigure.setLogEnabled(true);
        UMConfigure.init(this, UMConfigure.DEVICE_TYPE_PHONE, "5ad41345b27b0a441b00003d");
        PlatformConfig.setWeixin("wxb260ea86e530cae9", "fa25547c88a456ef2790247ea3b124e0");
        PlatformConfig.setSinaWeibo("2155154430", "b70832e1eeb44b76a54a44d9bbaf11e8", "http://www.joytalk/");
//        PlatformConfig.setSinaWeibo("82865878", "e5a06a36bb916478e1f9ea3cee61c914", "http://www.joytalk/");
        PlatformConfig.setQQZone("100424468", "c7394704798a158208a74ab60104f0ba");
        //极光
        JPushInterface.setDebugMode(true);
        JPushInterface.init(this);
        JMessageClient.setDebugMode(true);
        JMessageClient.init(this);
    }

    public static BaseApplication getInstance(){
        return mInstance;
    }

    @Override
    protected void attachBaseContext(Context base) {
        MultiDex.install(this);
        super.attachBaseContext(base);
    }

    @Override
    public void onTerminate() {
        super.onTerminate();
        JMessageClient.logout();
    }
}
